<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <script src="lib/esl.js"></script>
        <script src="lib/config.js"></script>
        <script src="lib/jquery.min.js"></script>
        <script src="lib/facePrint.js"></script>
    </head>
    <body>
        <style>
            html, body, #main {
                width: 100%;
                height: 100%;
                margin: 0;
            }
        </style>
        <div id="main"></div>
        <script>

            require([
                'echarts'
                // 'echarts/chart/map',
                // 'echarts/component/title',
                // 'echarts/component/legend',
                // 'echarts/component/visualMap',
                // 'echarts/component/markPoint',
                // 'echarts/component/tooltip'
            ], function (echarts) {

                require(['map/js/province/guangdong'], function () {
                    var chart = echarts.init(document.getElementById('main'));

                    var itemStyle = {
                        normal:{
                            borderColor: 'rgba(0, 0, 0, 0.2)'
                        },
                        emphasis:{
                            shadowOffsetX: 0,
                            shadowOffsetY: 0,
                            shadowBlur: 20,
                            borderWidth: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    };
                    var aaOption = {
                        tooltip: {},
                        title : {
                            text: 'iphone销量',
                            subtext: '纯属虚构',
                            left: 'center'
                        },
                        legend: {
                            orient: 'vertical',
                            top:'20%',
                            right:"10%",
                            data:['iphone3','iphone4','iphone5']
                        },
                        visualMap: {
                            min: 0,
                            max: 1500,
                            bottom:'20%',
                            right:"10%",
                            text:['高','低'],           // 文本，默认为数值文本
                            calculable : true
                        },
                        selectedMode: 'single',
                        series : [
                            {
                                name: 'iphone3',
                                type: 'map',
                                map: '广东',
                                itemStyle: itemStyle,
                                showLegendSymbol: true,
                                // zoom: 10,
                                // center: [115.97, 29.71],
                                roam: true,
                                markPoint: {
                                    data: [{
                                        coord: [115.97, 29.71]
                                    }]
                                },
                                label: {
                                    normal: {
                                        show: true,
                                        rotate: 40,
                                        formatter: '{b}：{value|{c}}',
                                        // position: 'inside',
                                        backgroundColor: '#fff',
                                        padding: [3, 5],
                                        borderRadius: 3,
                                        borderWidth: 1,
                                        borderColor: 'rgba(0,0,0,0.5)',
                                        color: '#777',
                                        rich: {
                                            value: {
                                                color: '#019D2D',
                                                fontSize: 14,
                                                // fontWeight: 'bold'
                                                // textBorderWidth: 2,
                                                // textBorderColor: '#000'
                                            }
                                        }
                                    },
                                    emphasis: {
                                        show: true
                                    }
                                },
                                data:[
                                    {name: '广州市',value: Math.round(Math.random()*1000)},
                                    {name: '茂名市',value: Math.round(Math.random()*1000)},
                                    {name: '湛江市',value: Math.round(Math.random()*1000)},
                                    {name: '江门市',value: Math.round(Math.random()*1000)},
                                    {name: '东莞市',value: Math.round(Math.random()*1000)},
                                    {name: '佛山市',value: Math.round(Math.random()*1000)},
                                    {name: '清远市',value: Math.round(Math.random()*1000)},
                                    {name: '中山市',value: Math.round(Math.random()*1000)},
                                    {name: '肇庆市',value: Math.round(Math.random()*1000)},
                                    {name: '深圳市',value: Math.round(Math.random()*1000)},
                                    {name: '汕头市',value: Math.round(Math.random()*1000)},
                                    {name: '汕尾市',value: Math.round(Math.random()*1000)},
                                    {name: '韶关市',value: Math.round(Math.random()*1000)},
                                    {name: '潮州市',value: Math.round(Math.random()*1000)},
                                    {name: '梅州市',value: Math.round(Math.random()*1000)},
                                    {name: '揭阳市',value: Math.round(Math.random()*1000)},
                                    {name: '惠州市',value: Math.round(Math.random()*1000)},
                                    {name: '河源市',value: Math.round(Math.random()*1000)}
                                ]
                            },
                            {
                                name: 'iphone4',
                                type: 'map',
                                mapType: '广东',
                                itemStyle: itemStyle,
                                showLegendSymbol: true,
                                label: {
                                    normal: {
                                        show: true
                                    },
                                    emphasis: {
                                        show: true
                                    }
                                },
                                data:[
                                    {name: '广州市',value: Math.round(Math.random()*1000)},
                                    {name: '茂名市',value: Math.round(Math.random()*1000)},
                                    {name: '湛江市',value: Math.round(Math.random()*1000)},
                                    {name: '江门市',value: Math.round(Math.random()*1000)},
                                    {name: '东莞市',value: Math.round(Math.random()*1000)},
                                    {name: '佛山市',value: Math.round(Math.random()*1000)},
                                    {name: '清远市',value: Math.round(Math.random()*1000)},
                                    {name: '中山市',value: Math.round(Math.random()*1000)},
                                    {name: '肇庆市',value: Math.round(Math.random()*1000)},
                                    {name: '深圳市',value: Math.round(Math.random()*1000)},
                                    {name: '汕头市',value: Math.round(Math.random()*1000)},
                                    {name: '汕尾市',value: Math.round(Math.random()*1000)},
                                    {name: '韶关市',value: Math.round(Math.random()*1000)},
                                    {name: '潮州市',value: Math.round(Math.random()*1000)},
                                    {name: '梅州市',value: Math.round(Math.random()*1000)},
                                    {name: '揭阳市',value: Math.round(Math.random()*1000)},
                                    {name: '惠州市',value: Math.round(Math.random()*1000)},
                                    {name: '河源市',value: Math.round(Math.random()*1000)}
                                ]
                            },
                            {
                                name: 'iphone5',
                                type: 'map',
                                mapType: '广东',
                                itemStyle: itemStyle,
                                showLegendSymbol: true,
                                label: {
                                    normal: {
                                        show: true
                                    },
                                    emphasis: {
                                        show: true
                                    }
                                },
                                data:[
                                    {name: '广州市',value: Math.round(Math.random()*1000)},
                                    {name: '茂名市',value: Math.round(Math.random()*1000)},
                                    {name: '湛江市',value: Math.round(Math.random()*1000)},
                                    {name: '江门市',value: Math.round(Math.random()*1000)},
                                    {name: '东莞市',value: Math.round(Math.random()*1000)},
                                    {name: '佛山市',value: Math.round(Math.random()*1000)},
                                    {name: '清远市',value: Math.round(Math.random()*1000)},
                                    {name: '中山市',value: Math.round(Math.random()*1000)},
                                    {name: '肇庆市',value: Math.round(Math.random()*1000)},
                                    {name: '深圳市',value: Math.round(Math.random()*1000)},
                                    {name: '汕头市',value: Math.round(Math.random()*1000)},
                                    {name: '汕尾市',value: Math.round(Math.random()*1000)},
                                    {name: '韶关市',value: Math.round(Math.random()*1000)},
                                    {name: '潮州市',value: Math.round(Math.random()*1000)},
                                    {name: '梅州市',value: Math.round(Math.random()*1000)},
                                    {name: '揭阳市',value: Math.round(Math.random()*1000)},
                                    {name: '惠州市',value: Math.round(Math.random()*1000)},
                                    {name: '河源市',value: Math.round(Math.random()*1000)}
                                ]
                            }
                        ]
                    };
                    chart.setOption(aaOption);

                    chart.on('click', function (param) {
                        console.log(param);
                    });
                    // setTimeout(function () {
                    //     chart.setOption({
                    //         series: [{
                    //             zoom: 5
                    //         }]
                    //     });
                    // }, 2000);
                });
            });

        </script>
    </body>
</html>
